# -*- coding: utf-8 -*-
from datetime import timedelta
from utils.operators.spark_submit import SparkSubmitOperator
from airflow.models import Variable
from utils import combine
from utils.alerts import dingding_task_alert
from utils.alerts.phone_call import call_phone_by_email
from utils.alerts.yl_threeSegCodeOnFailue import yl_threeSegCodeOnFailure
from utils.alerts.yl_threeSegCodeOnSuccess import yl_threeSegCodeOnSuccess

jdbcUrl='{{ var.json.oracle_bigdata04.url }}'
username='{{ var.json.oracle_bigdata04.username }}'
password='{{ var.json.oracle_bigdata04.password }}'
# jdbcUrl='jdbc:oracle:thin:@pro-push02-readwrite-ora.yl.com:1521:orcl'
# username='jms_push'
# password='Push_JTdb_Yunlu'
nowdt='{{ execution_date | cst_ds }}'
nextdt='{{ execution_date | date_add(1) | cst_ds }}'
table = "yl_oms_oms_waybill_back"
env='{{ var.value.env_sync }}'

jsonpara = """{
"reader":{
"connect":{
"url":"jdbcUrlpara",
"username":"usernamepara",
"password":"passwordpara",
"driver":"oracle.jdbc.driver.OracleDriver"
},
"dbtype":"oracle",
"tableName":"yl_oms_oms_waybill",
"where":"
(input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 01:00:00', 'yyyy-mm-dd hh24:mi:ss')) ;
(input_time>=to_date('nowdt 01:00:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 02:00:00', 'yyyy-mm-dd hh24:mi:ss')) ;
(input_time>=to_date('nowdt 02:00:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 03:00:00', 'yyyy-mm-dd hh24:mi:ss')) ;
(input_time>=to_date('nowdt 03:00:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 04:00:00', 'yyyy-mm-dd hh24:mi:ss')) ;
(input_time>=to_date('nowdt 04:00:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 05:00:00', 'yyyy-mm-dd hh24:mi:ss')) ;
(input_time>=to_date('nowdt 05:00:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 06:00:00', 'yyyy-mm-dd hh24:mi:ss')) ;
(input_time>=to_date('nowdt 06:00:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 07:00:00', 'yyyy-mm-dd hh24:mi:ss')) ;
(input_time>=to_date('nowdt 07:00:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 08:00:00', 'yyyy-mm-dd hh24:mi:ss')) ;
(input_time>=to_date('nowdt 08:00:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 09:00:00', 'yyyy-mm-dd hh24:mi:ss')) ;
(input_time>=to_date('nowdt 09:00:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 10:00:00', 'yyyy-mm-dd hh24:mi:ss')) ;
(input_time>=to_date('nowdt 10:00:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 11:00:00', 'yyyy-mm-dd hh24:mi:ss')) ;
(input_time>=to_date('nowdt 11:00:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 12:00:00', 'yyyy-mm-dd hh24:mi:ss')) ;
(input_time>=to_date('nowdt 12:00:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 13:00:00', 'yyyy-mm-dd hh24:mi:ss')) ;
(input_time>=to_date('nowdt 13:00:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 14:00:00', 'yyyy-mm-dd hh24:mi:ss')) ;

(input_time>=to_date('nowdt 14:00:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 14:30:00', 'yyyy-mm-dd hh24:mi:ss')) ;
(input_time>=to_date('nowdt 14:30:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 15:00:00', 'yyyy-mm-dd hh24:mi:ss')) ;

(input_time>=to_date('nowdt 15:00:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 15:30:00', 'yyyy-mm-dd hh24:mi:ss')) ;
(input_time>=to_date('nowdt 15:30:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 16:00:00', 'yyyy-mm-dd hh24:mi:ss')) ;

(input_time>=to_date('nowdt 16:00:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 16:30:00', 'yyyy-mm-dd hh24:mi:ss')) ;
(input_time>=to_date('nowdt 16:30:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 17:00:00', 'yyyy-mm-dd hh24:mi:ss')) ;

(input_time>=to_date('nowdt 17:00:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 17:30:00', 'yyyy-mm-dd hh24:mi:ss')) ;
(input_time>=to_date('nowdt 17:30:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 18:00:00', 'yyyy-mm-dd hh24:mi:ss')) ;

(input_time>=to_date('nowdt 18:00:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 18:30:00', 'yyyy-mm-dd hh24:mi:ss')) ;
(input_time>=to_date('nowdt 18:30:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 19:00:00', 'yyyy-mm-dd hh24:mi:ss')) ;

(input_time>=to_date('nowdt 19:00:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 19:30:00', 'yyyy-mm-dd hh24:mi:ss')) ;
(input_time>=to_date('nowdt 19:30:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 20:00:00', 'yyyy-mm-dd hh24:mi:ss')) ;

(input_time>=to_date('nowdt 20:00:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 20:30:00', 'yyyy-mm-dd hh24:mi:ss')) ;
(input_time>=to_date('nowdt 20:30:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 21:00:00', 'yyyy-mm-dd hh24:mi:ss')) ;

(input_time>=to_date('nowdt 21:00:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 21:30:00', 'yyyy-mm-dd hh24:mi:ss')) ;
(input_time>=to_date('nowdt 21:30:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 22:00:00', 'yyyy-mm-dd hh24:mi:ss')) ;

(input_time>=to_date('nowdt 22:00:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 22:30:00', 'yyyy-mm-dd hh24:mi:ss')) ;
(input_time>=to_date('nowdt 22:30:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nowdt 23:00:00', 'yyyy-mm-dd hh24:mi:ss')) ;

(input_time>=to_date('nowdt 23:00:00', 'yyyy-mm-dd hh24:mi:ss') and input_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')) ;


(input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-1  and input_time<to_date('nowdt 01:00:00', 'yyyy-mm-dd hh24:mi:ss')-1) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 01:00:00', 'yyyy-mm-dd hh24:mi:ss')-1  and input_time<to_date('nowdt 02:00:00', 'yyyy-mm-dd hh24:mi:ss')-1) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 02:00:00', 'yyyy-mm-dd hh24:mi:ss')-1  and input_time<to_date('nowdt 03:00:00', 'yyyy-mm-dd hh24:mi:ss')-1) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 03:00:00', 'yyyy-mm-dd hh24:mi:ss')-1  and input_time<to_date('nowdt 04:00:00', 'yyyy-mm-dd hh24:mi:ss')-1) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 04:00:00', 'yyyy-mm-dd hh24:mi:ss')-1  and input_time<to_date('nowdt 05:00:00', 'yyyy-mm-dd hh24:mi:ss')-1) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 05:00:00', 'yyyy-mm-dd hh24:mi:ss')-1  and input_time<to_date('nowdt 06:00:00', 'yyyy-mm-dd hh24:mi:ss')-1) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 06:00:00', 'yyyy-mm-dd hh24:mi:ss')-1  and input_time<to_date('nowdt 07:00:00', 'yyyy-mm-dd hh24:mi:ss')-1) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 07:00:00', 'yyyy-mm-dd hh24:mi:ss')-1  and input_time<to_date('nowdt 08:00:00', 'yyyy-mm-dd hh24:mi:ss')-1) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 08:00:00', 'yyyy-mm-dd hh24:mi:ss')-1  and input_time<to_date('nowdt 09:00:00', 'yyyy-mm-dd hh24:mi:ss')-1) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 09:00:00', 'yyyy-mm-dd hh24:mi:ss')-1  and input_time<to_date('nowdt 10:00:00', 'yyyy-mm-dd hh24:mi:ss')-1) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 10:00:00', 'yyyy-mm-dd hh24:mi:ss')-1  and input_time<to_date('nowdt 11:00:00', 'yyyy-mm-dd hh24:mi:ss')-1) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 11:00:00', 'yyyy-mm-dd hh24:mi:ss')-1  and input_time<to_date('nowdt 12:00:00', 'yyyy-mm-dd hh24:mi:ss')-1) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 12:00:00', 'yyyy-mm-dd hh24:mi:ss')-1  and input_time<to_date('nowdt 13:00:00', 'yyyy-mm-dd hh24:mi:ss')-1) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 13:00:00', 'yyyy-mm-dd hh24:mi:ss')-1  and input_time<to_date('nowdt 14:00:00', 'yyyy-mm-dd hh24:mi:ss')-1) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');

(input_time>=to_date('nowdt 14:00:00', 'yyyy-mm-dd hh24:mi:ss')-1  and input_time<to_date('nowdt 16:00:00', 'yyyy-mm-dd hh24:mi:ss')-1) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 16:00:00', 'yyyy-mm-dd hh24:mi:ss')-1  and input_time<to_date('nowdt 17:00:00', 'yyyy-mm-dd hh24:mi:ss')-1) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 17:00:00', 'yyyy-mm-dd hh24:mi:ss')-1  and input_time<to_date('nowdt 18:00:00', 'yyyy-mm-dd hh24:mi:ss')-1) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 18:00:00', 'yyyy-mm-dd hh24:mi:ss')-1  and input_time<to_date('nowdt 19:00:00', 'yyyy-mm-dd hh24:mi:ss')-1) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 19:00:00', 'yyyy-mm-dd hh24:mi:ss')-1  and input_time<to_date('nowdt 20:00:00', 'yyyy-mm-dd hh24:mi:ss')-1) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 20:00:00', 'yyyy-mm-dd hh24:mi:ss')-1  and input_time<to_date('nowdt 22:00:00', 'yyyy-mm-dd hh24:mi:ss')-1) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 22:00:00', 'yyyy-mm-dd hh24:mi:ss')-1 and input_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-1) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');


(input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-2  and input_time<to_date('nowdt 01:00:00', 'yyyy-mm-dd hh24:mi:ss')-2) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 01:00:00', 'yyyy-mm-dd hh24:mi:ss')-2  and input_time<to_date('nowdt 02:00:00', 'yyyy-mm-dd hh24:mi:ss')-2) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 02:00:00', 'yyyy-mm-dd hh24:mi:ss')-2  and input_time<to_date('nowdt 03:00:00', 'yyyy-mm-dd hh24:mi:ss')-2) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 03:00:00', 'yyyy-mm-dd hh24:mi:ss')-2  and input_time<to_date('nowdt 04:00:00', 'yyyy-mm-dd hh24:mi:ss')-2) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 04:00:00', 'yyyy-mm-dd hh24:mi:ss')-2  and input_time<to_date('nowdt 05:00:00', 'yyyy-mm-dd hh24:mi:ss')-2) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 05:00:00', 'yyyy-mm-dd hh24:mi:ss')-2  and input_time<to_date('nowdt 06:00:00', 'yyyy-mm-dd hh24:mi:ss')-2) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 06:00:00', 'yyyy-mm-dd hh24:mi:ss')-2  and input_time<to_date('nowdt 07:00:00', 'yyyy-mm-dd hh24:mi:ss')-2) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 07:00:00', 'yyyy-mm-dd hh24:mi:ss')-2  and input_time<to_date('nowdt 08:00:00', 'yyyy-mm-dd hh24:mi:ss')-2) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 08:00:00', 'yyyy-mm-dd hh24:mi:ss')-2  and input_time<to_date('nowdt 09:00:00', 'yyyy-mm-dd hh24:mi:ss')-2) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 09:00:00', 'yyyy-mm-dd hh24:mi:ss')-2  and input_time<to_date('nowdt 10:00:00', 'yyyy-mm-dd hh24:mi:ss')-2) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 10:00:00', 'yyyy-mm-dd hh24:mi:ss')-2  and input_time<to_date('nowdt 11:00:00', 'yyyy-mm-dd hh24:mi:ss')-2) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 11:00:00', 'yyyy-mm-dd hh24:mi:ss')-2  and input_time<to_date('nowdt 12:00:00', 'yyyy-mm-dd hh24:mi:ss')-2) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 12:00:00', 'yyyy-mm-dd hh24:mi:ss')-2  and input_time<to_date('nowdt 13:00:00', 'yyyy-mm-dd hh24:mi:ss')-2) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 13:00:00', 'yyyy-mm-dd hh24:mi:ss')-2  and input_time<to_date('nowdt 14:00:00', 'yyyy-mm-dd hh24:mi:ss')-2) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');

(input_time>=to_date('nowdt 14:00:00', 'yyyy-mm-dd hh24:mi:ss')-2  and input_time<to_date('nowdt 16:00:00', 'yyyy-mm-dd hh24:mi:ss')-2) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 16:00:00', 'yyyy-mm-dd hh24:mi:ss')-2  and input_time<to_date('nowdt 17:00:00', 'yyyy-mm-dd hh24:mi:ss')-2) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 17:00:00', 'yyyy-mm-dd hh24:mi:ss')-2  and input_time<to_date('nowdt 18:00:00', 'yyyy-mm-dd hh24:mi:ss')-2) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 18:00:00', 'yyyy-mm-dd hh24:mi:ss')-2  and input_time<to_date('nowdt 19:00:00', 'yyyy-mm-dd hh24:mi:ss')-2) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 19:00:00', 'yyyy-mm-dd hh24:mi:ss')-2  and input_time<to_date('nowdt 20:00:00', 'yyyy-mm-dd hh24:mi:ss')-2) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 20:00:00', 'yyyy-mm-dd hh24:mi:ss')-2  and input_time<to_date('nowdt 22:00:00', 'yyyy-mm-dd hh24:mi:ss')-2) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 22:00:00', 'yyyy-mm-dd hh24:mi:ss')-2 and input_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-2) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');


(input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-3  and input_time<to_date('nowdt 01:00:00', 'yyyy-mm-dd hh24:mi:ss')-3) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 01:00:00', 'yyyy-mm-dd hh24:mi:ss')-3  and input_time<to_date('nowdt 02:00:00', 'yyyy-mm-dd hh24:mi:ss')-3) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 02:00:00', 'yyyy-mm-dd hh24:mi:ss')-3  and input_time<to_date('nowdt 03:00:00', 'yyyy-mm-dd hh24:mi:ss')-3) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 03:00:00', 'yyyy-mm-dd hh24:mi:ss')-3  and input_time<to_date('nowdt 04:00:00', 'yyyy-mm-dd hh24:mi:ss')-3) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 04:00:00', 'yyyy-mm-dd hh24:mi:ss')-3  and input_time<to_date('nowdt 05:00:00', 'yyyy-mm-dd hh24:mi:ss')-3) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 05:00:00', 'yyyy-mm-dd hh24:mi:ss')-3  and input_time<to_date('nowdt 06:00:00', 'yyyy-mm-dd hh24:mi:ss')-3) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 06:00:00', 'yyyy-mm-dd hh24:mi:ss')-3  and input_time<to_date('nowdt 07:00:00', 'yyyy-mm-dd hh24:mi:ss')-3) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 07:00:00', 'yyyy-mm-dd hh24:mi:ss')-3  and input_time<to_date('nowdt 08:00:00', 'yyyy-mm-dd hh24:mi:ss')-3) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 08:00:00', 'yyyy-mm-dd hh24:mi:ss')-3  and input_time<to_date('nowdt 09:00:00', 'yyyy-mm-dd hh24:mi:ss')-3) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 09:00:00', 'yyyy-mm-dd hh24:mi:ss')-3  and input_time<to_date('nowdt 10:00:00', 'yyyy-mm-dd hh24:mi:ss')-3) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 10:00:00', 'yyyy-mm-dd hh24:mi:ss')-3  and input_time<to_date('nowdt 11:00:00', 'yyyy-mm-dd hh24:mi:ss')-3) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 11:00:00', 'yyyy-mm-dd hh24:mi:ss')-3  and input_time<to_date('nowdt 12:00:00', 'yyyy-mm-dd hh24:mi:ss')-3) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 12:00:00', 'yyyy-mm-dd hh24:mi:ss')-3  and input_time<to_date('nowdt 13:00:00', 'yyyy-mm-dd hh24:mi:ss')-3) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 13:00:00', 'yyyy-mm-dd hh24:mi:ss')-3  and input_time<to_date('nowdt 14:00:00', 'yyyy-mm-dd hh24:mi:ss')-3) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');

(input_time>=to_date('nowdt 14:00:00', 'yyyy-mm-dd hh24:mi:ss')-3  and input_time<to_date('nowdt 16:00:00', 'yyyy-mm-dd hh24:mi:ss')-3)  and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 16:00:00', 'yyyy-mm-dd hh24:mi:ss')-3  and input_time<to_date('nowdt 18:00:00', 'yyyy-mm-dd hh24:mi:ss')-3)  and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 18:00:00', 'yyyy-mm-dd hh24:mi:ss')-3  and input_time<to_date('nowdt 20:00:00', 'yyyy-mm-dd hh24:mi:ss')-3)  and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 20:00:00', 'yyyy-mm-dd hh24:mi:ss')-3  and input_time<to_date('nowdt 22:00:00', 'yyyy-mm-dd hh24:mi:ss')-3)  and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 22:00:00', 'yyyy-mm-dd hh24:mi:ss')-3 and input_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-3)  and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');


(input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-4  and input_time<to_date('nowdt 01:00:00', 'yyyy-mm-dd hh24:mi:ss')-4) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 01:00:00', 'yyyy-mm-dd hh24:mi:ss')-4  and input_time<to_date('nowdt 02:00:00', 'yyyy-mm-dd hh24:mi:ss')-4) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 02:00:00', 'yyyy-mm-dd hh24:mi:ss')-4  and input_time<to_date('nowdt 03:00:00', 'yyyy-mm-dd hh24:mi:ss')-4) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 03:00:00', 'yyyy-mm-dd hh24:mi:ss')-4  and input_time<to_date('nowdt 04:00:00', 'yyyy-mm-dd hh24:mi:ss')-4) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 04:00:00', 'yyyy-mm-dd hh24:mi:ss')-4  and input_time<to_date('nowdt 05:00:00', 'yyyy-mm-dd hh24:mi:ss')-4) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 05:00:00', 'yyyy-mm-dd hh24:mi:ss')-4  and input_time<to_date('nowdt 06:00:00', 'yyyy-mm-dd hh24:mi:ss')-4) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 06:00:00', 'yyyy-mm-dd hh24:mi:ss')-4  and input_time<to_date('nowdt 07:00:00', 'yyyy-mm-dd hh24:mi:ss')-4) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 07:00:00', 'yyyy-mm-dd hh24:mi:ss')-4  and input_time<to_date('nowdt 08:00:00', 'yyyy-mm-dd hh24:mi:ss')-4) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 08:00:00', 'yyyy-mm-dd hh24:mi:ss')-4  and input_time<to_date('nowdt 09:00:00', 'yyyy-mm-dd hh24:mi:ss')-4) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 09:00:00', 'yyyy-mm-dd hh24:mi:ss')-4  and input_time<to_date('nowdt 10:00:00', 'yyyy-mm-dd hh24:mi:ss')-4) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 10:00:00', 'yyyy-mm-dd hh24:mi:ss')-4  and input_time<to_date('nowdt 11:00:00', 'yyyy-mm-dd hh24:mi:ss')-4) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 11:00:00', 'yyyy-mm-dd hh24:mi:ss')-4  and input_time<to_date('nowdt 12:00:00', 'yyyy-mm-dd hh24:mi:ss')-4) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 12:00:00', 'yyyy-mm-dd hh24:mi:ss')-4  and input_time<to_date('nowdt 13:00:00', 'yyyy-mm-dd hh24:mi:ss')-4) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 13:00:00', 'yyyy-mm-dd hh24:mi:ss')-4  and input_time<to_date('nowdt 14:00:00', 'yyyy-mm-dd hh24:mi:ss')-4) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');

(input_time>=to_date('nowdt 14:00:00', 'yyyy-mm-dd hh24:mi:ss')-4  and input_time<to_date('nowdt 16:00:00', 'yyyy-mm-dd hh24:mi:ss')-4)  and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 16:00:00', 'yyyy-mm-dd hh24:mi:ss')-4  and input_time<to_date('nowdt 18:00:00', 'yyyy-mm-dd hh24:mi:ss')-4)  and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 18:00:00', 'yyyy-mm-dd hh24:mi:ss')-4  and input_time<to_date('nowdt 20:00:00', 'yyyy-mm-dd hh24:mi:ss')-4)  and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 20:00:00', 'yyyy-mm-dd hh24:mi:ss')-4  and input_time<to_date('nowdt 22:00:00', 'yyyy-mm-dd hh24:mi:ss')-4)  and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 22:00:00', 'yyyy-mm-dd hh24:mi:ss')-4 and input_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-4)  and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');


(input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-5  and input_time<to_date('nowdt 07:00:00', 'yyyy-mm-dd hh24:mi:ss')-5)  and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 07:00:00', 'yyyy-mm-dd hh24:mi:ss')-5  and input_time<to_date('nowdt 14:00:00', 'yyyy-mm-dd hh24:mi:ss')-5)  and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');

(input_time>=to_date('nowdt 14:00:00', 'yyyy-mm-dd hh24:mi:ss')-5  and input_time<to_date('nowdt 16:00:00', 'yyyy-mm-dd hh24:mi:ss')-5)  and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 16:00:00', 'yyyy-mm-dd hh24:mi:ss')-5  and input_time<to_date('nowdt 18:00:00', 'yyyy-mm-dd hh24:mi:ss')-5)  and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 18:00:00', 'yyyy-mm-dd hh24:mi:ss')-5  and input_time<to_date('nowdt 20:00:00', 'yyyy-mm-dd hh24:mi:ss')-5)  and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 20:00:00', 'yyyy-mm-dd hh24:mi:ss')-5  and input_time<to_date('nowdt 22:00:00', 'yyyy-mm-dd hh24:mi:ss')-5)  and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 22:00:00', 'yyyy-mm-dd hh24:mi:ss')-5 and input_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-5)  and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');


(input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-6  and input_time<to_date('nowdt 07:00:00', 'yyyy-mm-dd hh24:mi:ss')-6)  and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 07:00:00', 'yyyy-mm-dd hh24:mi:ss')-6  and input_time<to_date('nowdt 14:00:00', 'yyyy-mm-dd hh24:mi:ss')-6)  and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');

(input_time>=to_date('nowdt 14:00:00', 'yyyy-mm-dd hh24:mi:ss')-6  and input_time<to_date('nowdt 16:00:00', 'yyyy-mm-dd hh24:mi:ss')-6)  and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 16:00:00', 'yyyy-mm-dd hh24:mi:ss')-6  and input_time<to_date('nowdt 18:00:00', 'yyyy-mm-dd hh24:mi:ss')-6)  and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 18:00:00', 'yyyy-mm-dd hh24:mi:ss')-6  and input_time<to_date('nowdt 20:00:00', 'yyyy-mm-dd hh24:mi:ss')-6)  and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 20:00:00', 'yyyy-mm-dd hh24:mi:ss')-6  and input_time<to_date('nowdt 22:00:00', 'yyyy-mm-dd hh24:mi:ss')-6)  and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 22:00:00', 'yyyy-mm-dd hh24:mi:ss')-6 and input_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-6)  and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');


(input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-7  and input_time<to_date('nowdt 07:00:00', 'yyyy-mm-dd hh24:mi:ss')-7)  and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 07:00:00', 'yyyy-mm-dd hh24:mi:ss')-7  and input_time<to_date('nowdt 14:00:00', 'yyyy-mm-dd hh24:mi:ss')-7)  and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');

(input_time>=to_date('nowdt 14:00:00', 'yyyy-mm-dd hh24:mi:ss')-7  and input_time<to_date('nowdt 16:00:00', 'yyyy-mm-dd hh24:mi:ss')-7)  and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 16:00:00', 'yyyy-mm-dd hh24:mi:ss')-7  and input_time<to_date('nowdt 18:00:00', 'yyyy-mm-dd hh24:mi:ss')-7)  and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 18:00:00', 'yyyy-mm-dd hh24:mi:ss')-7  and input_time<to_date('nowdt 20:00:00', 'yyyy-mm-dd hh24:mi:ss')-7)  and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 20:00:00', 'yyyy-mm-dd hh24:mi:ss')-7  and input_time<to_date('nowdt 22:00:00', 'yyyy-mm-dd hh24:mi:ss')-7)  and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');
(input_time>=to_date('nowdt 22:00:00', 'yyyy-mm-dd hh24:mi:ss')-7 and input_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-7)  and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss');

((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-8 and input_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-8) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-9 and input_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-9) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-10 and input_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-10) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-12 and input_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-11) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-14 and input_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-13) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-15 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-14) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-16 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-15) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-17 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-16) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-18 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-17) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-19 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-18) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-20 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-19) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-21 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-20) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-22 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-21) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-23 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-22) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-24 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-23) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-25 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-24) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-26 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-25) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-27 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-26) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-28 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-27) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-29 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-28) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-30 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-29) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-31 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-30) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-32 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-31) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-33 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-32) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-34 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-33) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-35 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-34) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-36 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-35) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-37 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-36) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-38 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-37) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-39 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-38) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-40 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-39) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-41 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-40) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-42 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-41) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-43 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-42) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-44 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-43) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-45 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-44) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-46 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-45) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-47 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-46) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-48 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-47) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-49 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-48) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-50 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-49) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-51 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-50) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-52 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-51) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-53 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-52) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-54 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-53) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-55 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-54) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-56 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-55) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-57 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-56) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-58 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-57) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-59 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-58) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-60 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-59) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-61 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-60) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-62 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-61) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-63 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-62) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-64 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-63) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-65 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-64) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-66 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-65) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-67 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-66) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-68 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-67) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-69 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-68) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-70 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-69) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-71 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-70) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-72 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-71) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-73 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-72) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-74 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-73) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-75 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-74) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-76 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-75) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-77 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-76) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-78 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-77) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-79 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-78) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-80 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-79) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-81 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-80) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-82 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-81) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-83 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-82) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-84 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-83) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-85 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-84) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-86 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-85) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-87 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-86) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-88 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-87) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-89 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-88) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
((input_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-90 and input_time<to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss')-89) and last_update_time>=to_date('nowdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss') and last_update_time<to_date('nextdt 00:00:00', 'yyyy-mm-dd hh24:mi:ss'));
",
"query":"",
"splitColumn":"",
"equalitySectioning":0,
"containsnull":0,
"fetchsize":"1024",
"threadNumber":-1
},
"channel":{
"filterAbnormalCharacter":1
},
"writer":{
"dbtype":"hive",
"tableName":"tablepara",
"database":"jms_ods",
"writeMode": "overwrite",
"partitionColumn":"dt",
"partitionValue":"nowdt"},
"settting":{
"env":"envpara"}
}""".replace("jdbcUrlpara", jdbcUrl).replace("usernamepara", username).replace("passwordpara", password). \
    replace("nowdt", nowdt).replace("nextdt", nextdt). \
    replace("tablepara", table). \
    replace("envpara", env)

#
# def kwargs():
#     kwargs = {
#         "db": "jms_ods",
#         "table": "yl_oms_oms_waybill_back",
#         "desc": "ods层运单表",
#         "taskid": "10070",
#         "ifprivacy": 1,
#         "warnignore": 0,
#     }
#     return kwargs

# from airflow.operators.dummy_operator import DummyOperator
# jms_ods__yl_oms_oms_waybill_back = DummyOperator(
#     task_id='jms_ods__yl_oms_oms_waybill_back',
#     email='songjun@yl-scm.com',
#     retries=0,
#     priority_weight=0,
#     # sla=timedelta(hours=2),
#     on_success_callback=yl_threeSegCodeOnSuccess(kwargs(), dingding_conn_id="dingding_ThreeSeg_etl_info"),
#     on_failure_callback=yl_threeSegCodeOnFailure(kwargs(), dingding_conn_id="dingding_ThreeSeg_etl_alert"),
# )


# env = Variable.get('env', '')
jms_ods__yl_oms_oms_waybill_back = SparkSubmitOperator(
    task_id='jms_ods__yl_oms_oms_waybill_back',
    name='jms_ods__yl_oms_oms_waybill_back_{{ execution_date | date_add(1) |  cst_ds }}',
    email=['yl_etl@yl-scm.com','yl_bigdata@yl-scm.com'],
    pool='oracle_tab',
    pool_slots=12,
    execution_timeout=timedelta(hours=2),
    driver_memory='10G',
    executor_memory='10G',
    executor_cores=2,
    num_executors=25,
    conf={'spark.dynamicAllocation.enabled'                  : 'true',
          'spark.shuffle.service.enabled'                    : 'true',
          'spark.dynamicAllocation.maxExecutors'             : 25,
          'spark.dynamicAllocation.cachedExecutorIdleTimeout': 30,
          'spark.sql.sources.partitionOverwriteMode'         : 'dynamic',
          'spark.executor.memoryOverhead'                    : '1G',
          },
    java_class='com.yunlu.bigdata.jobs.synchrotool.DataSynchDriver',  # spark 主类
    application='hdfs:///scheduler/jms/spark/sync/spark_sync.jar',  # spark jar 包
    application_args=[jsonpara, ],
    # email_on_retry=env.upper() == 'PRO',
    # on_retry_callback=combine([dingding_task_alert(dingding_conn_id='dingding_bigdata'),
    #                            call_phone_by_email()],
    #                           ignore_error=True) if env.upper() == 'PRO' else None,
    sla=timedelta(hours=4),
    # on_success_callback=yl_threeSegCodeOnSuccess(kwargs(), dingding_conn_id="dingding_ThreeSeg_etl_info"),
    # on_failure_callback=yl_threeSegCodeOnFailure(kwargs(), dingding_conn_id="dingding_ThreeSeg_etl_alert"),
)
